package Composite_Pattern.Education;

import java.util.ArrayList;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class Office_m extends AbstractOffice{
    private ArrayList<AbstractOffice> abstractOffices=new ArrayList<AbstractOffice>();
    private String name;
    public Office_m(String name){
        this.name=name;
    }

    @Override
    public AbstractOffice getChild(int i) {
        return (AbstractOffice)abstractOffices.get(i);
    }

    @Override
    public void add(AbstractOffice office) {
        abstractOffices.add(office);
    }

    @Override
    public void Notice() {
        System.out.println("通知已发布到"+name);
        for (Object obj:abstractOffices){
            ((AbstractOffice)obj).Notice();
        }
    }
}
